﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            var mySelect = document.getElementById("mySelect");

            //属性:
            var index = mySelect.selectedIndex;
            var options = mySelect.options;

            //添加选项add() , appendChild(), insertBefore()
            var newOption = document.createElement("option");
            newOption.value = "5";
            newOption.text = "5";
            mySelect.add(newOption);

            //删除选项remove(), removeChild()
            mySelect.remove(0);

            //设置选中项的2种方式
            mySelect.selectedIndex = 2;
            mySelect.options[2].selected = true;
        }
    </script>
</head>
<body>
    <form name="myForm">
        <div>
            <span>放假天数</span>
            <select id="mySelect" style="width:100px"  >
                <option ></option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
            </select>
        </div>
    </form>
</body>
</html>
